class DomainBean {
  final int? sort;
  final int? id;
  final String? title;
  final String? key;
  final String? keys;
  List<DomainFilterChild>? children;

  DomainBean({
    this.sort,
    this.id,
    this.title,
    this.key,
    this.keys,
    this.children,
  });

  factory DomainBean.fromJson(Map<String, dynamic> json) {
    return DomainBean(
      sort: json['sort'],
      id: json['id'],
      title: json['title'],
      key: json['key'],
      keys: json['keys'],
      children: json['children'] != null
          ? (json['children'] as List)
              .map((child) => DomainFilterChild.fromJson(child))
              .toList()
          : null,
    );
  }
}

class DomainFilterChild {
  final int? pid;
  final int? sort;
  String? name;
  final String? key;
  final String? type;
  final String? attr;
  final String? hint;
  final String? size;
  final String? unit;
  final bool? isFlow;
  final List<DomainFilterOption>? optional;
  List<DomainFilterOption>? options;
  final Map<String, dynamic>? sData;
  Map<String, dynamic>? custom;
  List<dynamic>? data;

  DomainFilterChild({
    this.pid,
    this.sort,
    this.name,
    this.key,
    this.type,
    this.attr,
    this.hint,
    this.size,
    this.unit,
    this.isFlow,
    this.optional,
    this.options,
    this.sData,
    this.custom,
    this.data,
  });

  factory DomainFilterChild.fromJson(Map<String, dynamic> json) {
    return DomainFilterChild(
      pid: json['pid'],
      sort: json['sort'],
      name: json['name'],
      key: json['key'],
      type: json['type'],
      attr: json['attr'],
      hint: json['hint'],
      size: json['size'],
      unit: json['unit'],
      isFlow: json['is_flow'],
      optional: json['optional'] != null
          ? (json['optional'] as List)
              .map((opt) => DomainFilterOption.fromJson(opt))
              .toList()
          : null,
      options: json['options'] != null
          ? (json['options'] as List)
              .map((opt) => DomainFilterOption.fromJson(opt))
              .toList()
          : null,
      sData: json['s_data'],
      custom: json['custom'],
      data: json['data'],
    );
  }
}

class DomainFilterOption {
  final int? id;
  final String? name;
  final String? key;
  final String? value;
  final String? type;
  final List<DomainFilterChild>? children;
  final List<dynamic>? data;

  DomainFilterOption({
    this.id,
    this.name,
    this.key,
    this.value,
    this.type,
    this.children,
    this.data,
  });

  factory DomainFilterOption.fromJson(Map<String, dynamic> json) {
    return DomainFilterOption(
      id: json['id'],
      name: json['name'],
      key: json['key'],
      value: json['value'],
      type: json['type'],
      children: json['children'] != null
          ? (json['children'] as List)
              .map((child) => DomainFilterChild.fromJson(child))
              .toList()
          : null,
      data: json['data'],
    );
  }
}
